import { ArticleDetail } from '@/types/data'
import { ArticleAction } from '@/types/store'

type ArticleType = {
  info: ArticleDetail
}

const initialState: ArticleType = {
  // 文章详情数据
  info: {},
} as ArticleType

export default function article(
  state = initialState,
  action: ArticleAction
): ArticleType {
  switch (action.type) {
    case 'article/setArticleInfo':
      return {
        ...state,
        info: action.payload,
      }
    default:
      return state
  }
}
